﻿Imports BE.BE
Imports DAL.DAL

Namespace BL
    Public Class AbogadoEstudio_BL


        Shared Sub altaAbogadoEstudio(pAbogadoEstudio As AbogadoEstudio_BE)
            Try
                DAL_AbogadoEstudio.altaAbogadoEstudio(pAbogadoEstudio)

                If pAbogadoEstudio.Telefonos.Count > 0 Then
                    For Each telefono As Telefono_BE In pAbogadoEstudio.Telefonos

                        telefono.TipoObjeto = Telefono_BE.EnumTipoObjeto.AbogadoEstudio
                        telefono.IdObjeto = pAbogadoEstudio.IdAbogadoEstudio
                        Telefono_BL.guardarTelefono(telefono)

                    Next

                End If

            Catch ex As Exception
                Throw ex
            End Try
        End Sub


        Shared Function listarAbogadoEstudio() As List(Of AbogadoEstudio_BE)
            Dim mlista As New List(Of AbogadoEstudio_BE)

            Try
                mlista = DAL_AbogadoEstudio.listarAbogadoEstudio

                For Each aboest As AbogadoEstudio_BE In mlista

                    aboest.Telefonos = Telefono_BL.obtenerTelefonosXIdObjeto(aboest.id, Telefono_BE.EnumTipoObjeto.AbogadoEstudio)

                Next

                Return mlista


            Catch ex As Exception
                Throw ex
            End Try



        End Function
    End Class

End Namespace
